package demo;

/**
 *    链表中倒数第K个节点
 */
class Solution35 {
	public ListNode getKthFromEnd(ListNode head, int k) {
		ListNode fast = head;
		while (fast != null) {
			fast = fast.next;
			if (k == 0) {
				head = head.next;
			} else {
				k--;
			}
		}
		return head;
	}
}
